<template>
	<view>
	<!-- 	<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">招聘任务</block>
		</cu-custom> -->
		<view class="search-box">
			<view class="cu-bar search">
				<view class="search-form bg-white">
					<text class="cuIcon-search"></text>
					<input class="inp-sty" @focus="InputFocus" @blur="InputBlur" :adjust-position="false" type="text" placeholder="请输入岗位名称" v-model="searchText" confirm-type="search"></input>
				</view>
				<view class="action">
					<button class="cu-btn set-btn">搜索</button>
				</view>
			</view>
		</view>
		<view>
			<taskdetailItems :taskArray="taskArray"></taskdetailItems>
		</view>
	</view>
</template>

<script>
	import taskdetailItems from '../../components/item/recruitment-taskdetail-items'
	export default {
		data() {
			return {
				token:'',
				searchText:'', //搜索数据
				taskArray:[], //后台请求数据
			}
		},
		methods: {
			// 请求后台数据
			async reqData(){
				// 取token
				try {
				    const value = uni.getStorageSync('login_key');
				    if (value) {
						this.token = value;
				    }
				} catch (e) {
				    // error
				}
				// 发请求
				let url = this.ServicesApi.getPositionTaskList;
				let data = {
				    limit: 10,
				    page: this.page,
				    search:this.searchText
				};
				let result = await this.Services.post(url, data);
				if (result.code == this.StatusCode.SUCCESS_CODE) {
				    this.taskArray = result.data.data;
				} 
				
				// uni.request({
				//     url: this.ServicesApi.getPositionTaskList, 
				// 	method:'POST',
				// 	header: {
						
				// 		"content-type":"application/x-www-form-urlencoded"
				// 	},
				//     data: {
				// 		token:this.token,
				// 		page:1,
				// 		limit:10,
				// 		search:this.searchText
				//     },
				//     success: (res) => {
				// 		this.taskArray = res.data.data.data
				// 		// console.log(res.data.data.data)
				//     }
				// });
			}
		},
		components:{
			taskdetailItems
		},
		mounted(){
			this.reqData();
		}
	}
</script>

<style scoped lang="stylus">
	.search-box{
		height:100upx;
		.inp-sty{
			height:60upx;
			background:#fff;
		}
		.set-btn{
			font-size:30upx;
			color:#333;
		}
	}
</style>
